﻿<?php include $this->admin_tpl('meta');?>
<title>品牌列表</title>
</head>
<body>
<div class="page-container" style="padding-bottom:0;">
	<table id="table" class="mt-20" lay-filter="table"></table>
</div>
<script type="text/html" id="tool_temp">
	<a href="javascript:;" onclick="yzm_open('添加品牌','<?php echo U('brand_list',['type'=>'add']);?>','600','450')" class="btn btn-primary radius"><i class="yzm-iconfont yzm-icontianjia"></i> 添加品牌</a>
	<a href="javascript:;" id="btn_del" class="btn btn-danger radius"><i class="yzm-iconfont yzm-iconshanchu2"></i> 批量删除</a>
</script>
<script type="text/html" id="op_temp">
	<a class="layui-btn layui-btn-yzm layui-btn-xs" onclick="yzm_open('添加品牌','<?php echo U('brand_list',['type'=>'add']);?>?id={{= d.id}}','600','450')" lay-event="detail" style="text-decoration:none;">编辑</a>
	<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delete" style="text-decoration:none;">删除</a>
</script>
<script type="text/html" id="jst_id_temp">
  <button class="layui-btn layui-btn-primary dropdown-jst" style="height:28px;width:90px;padding:0 10px;">
    <span>{{= d.jst_name}}</span>
    <i class="layui-icon layui-icon-down layui-font-12" style="vertical-align: center;"></i>
  </button>
</script>
<script type="text/html" id="jst_id2_temp">
  <button class="layui-btn layui-btn-primary dropdown-jst2" style="height:28px;width:90px;padding:0 10px;">
    <span>{{= d.jst_name2}}</span>
    <i class="layui-icon layui-icon-down layui-font-12" style="vertical-align: center;"></i>
  </button>
</script>
<?php include $this->admin_tpl('footer');?>
<script type="text/javascript" src="<?php echo STATIC_URL;?>plugin/layui/layui.js"></script>

<script>
var db = 'jst_brand';
layui.use(function(){ //亦可加载特定模块：layui.use(['layer', 'laydate', function(){
	table = layui.table; //表格
	util = layui.util; //工具集
	dropdown = layui.dropdown; //下拉菜单
	form = layui.form;
	//执行一个 table 实例
	option = {
		elem: '#table',
		id:'table',
		height: 'full-80',
		limit:30,
		limits:[30,60,90],
		url:'<?php echo U('brand_list');?>',
		where: $('#search').serializeJson(),
		title: '店铺列表',
		autoSort: false,
		page: {theme:'#409eff',groups:3,hash:true}, //开启分页
		toolbar: '#tool_temp', //开启工具栏，此处显示默认图标，可以自定义模板，详见文档
		cols: [[ //表头
			{type: 'checkbox', fixed: 'left'},
			{field: 'id', title: 'ID', width:80,align:'center'},
			{field: 'name', title: '店铺简称', align:'left'},
			{field: 'is', title: '是否启用',align:'center',templet:function(row){
				if(row.status == 1){
					return '<span class="yzm-status-enable" data-field="status" data-text="启用|禁用" data-db="jst_brand" data-id="'+row.id+'" onclick="yzm_change_status(this,\'public_change_status\')"><i class="yzm-iconfont">&#xe81f;</i>启用</span>';
				}else{
					return '<span class="yzm-status-disable" data-field="status" data-text="启用|禁用" data-db="jst_brand" data-id="'+row.id+'" onclick="yzm_change_status(this,\'public_change_status\')"><i class="yzm-iconfont">&#xe601;</i>禁用</span>';
				}
			}},
			{field: 'jst_name', title: '商品资料绑定聚水潭',align:'center', templet:'#jst_id_temp'},
			{field: 'jst_name2', title: '库存信息绑定聚水潭',align:'center', templet:'#jst_id2_temp'},
			{field: 'is_ys', title: '是否佑晟',align:'center',templet:function(row){
				if(row.is_ys == 1){
					return '<span class="yzm-status-enable" data-field="is_ys" data-text="是|否" data-db="jst_brand" data-id="'+row.id+'" onclick="yzm_change_status(this,\'public_change_status\')"><i class="yzm-iconfont">&#xe81f;</i>是</span>';
				}else{
					return '<span class="yzm-status-disable" data-field="is_ys" data-text="是|否" data-db="jst_brand" data-id="'+row.id+'" onclick="yzm_change_status(this,\'public_change_status\')"><i class="yzm-iconfont">&#xe601;</i>否</span>';
				}
			}},
			{field: 'sort', title: '排序',align:'center', sort: true, width:100,edit:true},
			{field: 'toolbar',fixed: 'right', title: '操作', width: 200, align:'center', toolbar: '#op_temp'}
		]],
		done:function(res,curr,count){
			var options = this;
			public_table(db);
			select_table(options,<?php echo json_encode($this->jst_arr);?>,'.dropdown-jst',db,'jst_id');
			select_table(options,<?php echo json_encode($this->jst_arr);?>,'.dropdown-jst2',db,'jst_id2');
		}
	};
	table.render(option);
	init_table(db);
})
	
</script>
</body>
</html>